<%@ page language="java" contentType="text/html;charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<c:url value="/layui/css/layui.css"/>">
<title>添加客户信息</title>
</head>
<body>
<form action="<c:url value="/CustomerServlet"/>" method="post" class="layui-form" >
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>新增客户信息</legend>
</fieldset>
  <input style="display:none" value="" name="cid"/>
   <div class="layui-form-item">
    <label class="layui-form-label">名称</label>
	    <div class="layui-input-block">
	      <input type="text" name="cname" lay-verify="title" autocomplete="off" placeholder="请输入名称" class="layui-input">
	    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label">性别</label>
    <div class="layui-input-block">
      <input type="radio" name="gender" value="男" title="男" checked="">
      <input type="radio" name="gender" value="女" title="女">
    </div>
  </div>
  <div class="layui-form-item">
  	<div class="layui-inline">
      <label class="layui-form-label">生日</label>
      <div class="layui-input-inline">
        <input type="text" name="birthday" id="birthday" lay-verify="date" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <div class="layui-inline">
      <label class="layui-form-label">手机</label>
      <div class="layui-input-inline">
        <input type="text" name="cellphone" lay-verify="" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-inline">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-inline">
        <input type="text" name="email" lay-verify="" autocomplete="off" class="layui-input">
      </div>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">说明</label>
    <div class="layui-input-block">
      <textarea placeholder="请输入内容" class="layui-textarea" name="description"></textarea>
    </div>
  </div>
  <!--<div class="layui-form-item layui-form-text">
    <label class="layui-form-label">编辑器</label>
    <div class="layui-input-block">
      <textarea class="layui-textarea layui-hide" name="content" lay-verify="content" id="LAY_demo_editor"></textarea>
    </div>
  </div>-->
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button type="submit" class="layui-btn" lay-submit="" lay-filter="form_customer">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
  <input type="hidden" value="add" name="method"/>
</form>
	
<script src="<c:url value="/layui/layui.js"/>"></script>
<script>
layui.use(['form', 'layedit', 'laydate'], function(){
	  var form = layui.form
	  ,layer = layui.layer
	  ,layedit = layui.layedit
	  ,laydate = layui.laydate;
	  
	  //日期
	  laydate.render({
	    elem: '#birthday'
	  });

	 
	  //自定义验证规则
	  form.verify({
	    title: function(value){
	      if(value.length < 2){
	        return '标题至少得2个字符啊';
	      }
	    }
	  });
	  //监听提交
	   form.on('submit(form_customer)', function(data){
	    	console.log(data);  	
	   });
}) 

</script>

</body>
</html>